<template>
  <v-card>
    <v-flex xs12 sm10>
      <v-tree url="/item/category/list"
              :isEdit="isEdit"
              @handleAdd="handleAdd"
              @handleEdit="handleEdit"
              @handleDelete="handleDelete"
              @handleClick="handleClick"
      />
    </v-flex>
  </v-card>
</template>

<script>
  export default {
    name: "category",
    data() {
      return {
        isEdit: true
      }
    },
    methods: {
      handleAdd(node) {
        console.log("add .... ");
        console.log(node);
        this.$http.post("item/category/add", this.$qs.stringify(node));
      },
      handleEdit(id, name) {
        console.log("edit... id: " + id + ", name: " + name);
        alert(id);
        this.$http.put("/item/category/edit/", {

          id: id,
          name: name

        });
      },
      handleDelete(id) {
        console.log("delete ... " + id)
        this.$http.delete("/item/category/delete/" + id)
      },
      handleClick(node) {
        console.log(node)
      }
    }
  };
</script>

<style scoped>

</style>
